/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cassys.delegates;

import cassys.dataaccess.DAOException;
import cassys.datatransferobjects.ModuleDTO;
import cassys.datatransferobjects.TeamDTO;
import cassys.ejb.sessionbean.ModuleBeanRemote;
import cassys.servicelocator.ServiceLocator;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author User
 */
public class ModuleDelegate {

    private ModuleBeanRemote moduleBean = null;

    public ModuleDelegate() {
        moduleBean =  ServiceLocator.getInstance().lookupModuleBean();
    }
    public ArrayList<ModuleDTO> findAllModules() throws DAOException , RemoteException{
        ArrayList<ModuleDTO> mlist = new ArrayList<ModuleDTO>();
        mlist = moduleBean.findAllModules();
        return mlist;
    }
    
    public ModuleDTO findModule(String moduleCode) throws DAOException, RemoteException{
        ModuleDTO m = null;
        m = moduleBean.findModule(moduleCode);
        return m;
    }

    public void insertModule(ModuleDTO module) throws DAOException, RemoteException {
        moduleBean.insertModule(module);
    }

    public void updateModule(ModuleDTO module) throws DAOException, RemoteException {
        moduleBean.updateModule(module);
    }
    
    public void deleteModule(ModuleDTO module) throws DAOException, RemoteException {
        moduleBean.deleteModule(module);
    }
    
   
}
